<?php
/*
	监听电商客订单状态变更事件
*/
defined('BY_JYA') or exit('error');
$type=$event['type'];
$order=$event['order'];
if(!$type){
	return;
}
if($type=='pay'){
	//付款事件
	$this->model('commission')->create($order);
	if($this->setting['become_child']==3){
		//首次付款生成上下级关系
		$agent_id=$this->getcolumn('member',array('mid'=>$order['mid']),'agent_id');
		if(!$agent_id){
			$fromuser=pdo_getcolumn('core_members',array('id'=>$order['mid']),'fromuser');
			if($fromuser){
				$this->model('member')->set_parent($order['mid'],$fromuser);
			}
		}
	}
}
if($type=='send_goods'){
	//发货	
}
if($type=='receive_goods'){
	//收货	
}
if($type=='complete'){
	//完成
	$this->model('commission')->order_complete($order);
}
